﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Pseudogenerator.Common.Generators;
using Pseudogenerator.Common.ViewModels.Core;

namespace Pseudogenerator.Common.ViewModels
{
    public abstract class CongruentialViewModel<Tg>
        : WorkSpaceViewModel<Tg>
        where Tg : Congruential
    {

        public uint m
        {
            get
            {
                return ModeloActual.m;
            }
            set
            {
                if (ModeloActual.m == value)
                    return;
                ModeloActual.m = value;
                OnPropertyChanged();
                RefreshGUI();
            }
        }

        public uint x0
        {
            get
            {
                return ModeloActual.x0;
            }
            set
            {
                if (ModeloActual.x0 == value)
                    return;
                ModeloActual.x0 = value;
                OnPropertyChanged();
                RefreshGUI();
            }
        }

        public uint a
        {
            get
            {
                return ModeloActual.a;
            }
            set
            {
                if (ModeloActual.a == value)
                    return;
                ModeloActual.a = value;
                OnPropertyChanged();
                OnPropertyChanged("t");
                RefreshGUI();
            }
        }

        public override bool CanRun
        {
            get
            {
                return base.CanRun && ModeloActual.a > 0 &&
                       ModeloActual.m > ModeloActual.a;
            }
        }
    }
}
